package com.csii.activiti.server.core.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.activiti.server.core.entity.*;
import com.csii.activiti.server.core.query.*;

import java.util.List;
import java.util.Map;

public interface FlowQueryService {
    /**
     * 查询已发布流程
     * @param queryActFlowDefinition
     * @return List<ActFlowDefinition>
     */
    Page<ActFlowDefinition> queryApplyFlowList(QueryActFlowDefinition queryActFlowDefinition, Page page);

    /**
     * 查询维护流程和已发布流程
     * @return List<ActFlowGroup>
     */
    List<ActFlowGroup> queryMaintainFlowList(boolean selectFlowDefinition);

    /**
     * 查询待办
     * @param queryActFlowTodo
     * @return List<ActFlowTodo>
     */

    Page<ActFlowTodo> queryTodoList(QueryActFlowTodo queryActFlowTodo, Page page,String assignee);

    /**
     * 查询待办详情
     * @param id
     * @return ActFlowDetail
     */

    ActFlowDetail queryFlowDetail(String id);

    /**
     * 查询我的申请详情
     * @param processInstanceId
     * @return ActFlowDetail
     */

    ActFlowDetail queryMyApplyFlowDetail(String processInstanceId);


    /**
     * 查询已办
     * @param queryActFlowDone
     * @param page
     * @return Page<ActFlowDone>
     */

    Page<ActFlowDone> queryDoneList(QueryActFlowDone queryActFlowDone, Page page);

    /**
     * 查询我申请的
     * @param queryActFlowMyApply
     * @return List<ActFlowMyApply>
     */
    Page<ActFlowMyApply> queryMyApplyList(QueryActFlowMyApply queryActFlowMyApply, Page page);


    /**
     * 查询流程权限
     * @param flowId
     * @return ActFlowPermission
     */
    ActFlowPermission queryFlowPermission(String flowId);


    /**
     * 查询流程配置
     * @param flowId
     * @return ActFlowConfiguration
     */
    ActFlowConfiguration queryFlowConfiguration(String flowId);

    /**
     * 查询流程配置(通过流程key)
     * @param flowKey
     * @return ActFlowConfiguration
     */
    ActFlowConfiguration queryFlowConfigurationByFlowKey(String flowKey);


    /**
     * 查询流程申请
     * @param flowKey
     * @return ActFlowApply
     */

    ActFlowApply queryFlowApply(String flowKey);

    /**
     * 通过抄送ID查询详情页
     * @param pwcId
     * @return ActFlowDetail
     */

    ActFlowDetail queryFlowDetailByPwcId(String pwcId);

    /**
     * 通过任务ID查询签名
     * @param taskId
     * @return String
     */

    String queryDigitalSignatureByTaskId(String taskId);

    /**
     * 通过秘钥查询流程实列
     * @param key
     * @return String
     */

    List<ActFlowInstance> queryFlowInstanceByKey(String key);

    /**
     * 查询已转交记录
     * @param queryActFlowTransferRecord
     * @return List<ActFlowTransferRecord>
     */
    Page<ActFlowTransferRecord> queryTransferRecordList(QueryActFlowTransferRecord queryActFlowTransferRecord, Page page);

    /**
     * 查询执行流程（通过部署ID）
     * @param deploymentId
     * @param formData
     * @return List<ActFlowNode>
     */
    List<ActFlowNode> queryExecutionStream(String deploymentId, Map<String, Object> formData);

    /**
     * 查询执行流程（通过流程ID）
     * @param flowId
     * @param formData
     * @return List<ActFlowNode>
     */
    List<ActFlowNode> queryExecutionStreamByFlowId(String flowId, Map<String, Object> formData);

    /**
     * 查询流程申请
     * @param flowId
     * @return ActFlowApply
     */
    ActFlowApply queryFlowApplyByFlowId(String flowId);

    /**
     * 查询流程审批历史
     * @param processInstanceId
     * @return ActFlowApprovalHistory
     */
    List<ActFlowApprovalHistory> queryApprovalHistory(String processInstanceId,boolean isQueryToApprove);

    /**
     * 查询流程详情历史
     * @param processInstanceId
     * @return ActFlowApprovalHistory
     */
    List<ActFlowDetail> queryFlowDetailHistory(String processInstanceId);
}
